package cn.cqie.attendance.common.service.impl;

import cn.cqie.attendance.common.dao.LoginMapper;
import cn.cqie.attendance.common.pojo.Student;
import cn.cqie.attendance.common.pojo.Teacher;
import cn.cqie.attendance.common.pojo.User;
import cn.cqie.attendance.common.service.LoginService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl extends ServiceImpl<LoginMapper, User> implements LoginService {

    @Autowired
    private LoginMapper loginMapper;

    @Override
    public Teacher queryTeacher(String username) {
        return loginMapper.queryTeacher(username);
    }

    @Override
    public Student queryStudent(String username) {
        return loginMapper.queryStudent(username);
    }

    @Override
    public int loginOnce(int id, String role) {
        return loginMapper.loginOnce(role, id);
    }

    @Override
    public int changePassword(int id, String password, String role) {
        return loginMapper.changePassword(id, password, role);
    }
}
